home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / loadavg / RCS / loadavg.h,v < prev    next >
Encoding:
Text File  |  1989-08-01  |  6.1 KB  |  342 lines

  1. head     1.7;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.7
  10. date     89.07.31.17.51.57;  author douglis;  state Exp;
  11. branches ;
  12. next     1.6;
  13.  
  14. 1.6
  15. date     89.07.13.23.24.40;  author douglis;  state Exp;
  16. branches ;
  17. next     1.5;
  18.  
  19. 1.5
  20. date     89.05.04.15.49.00;  author douglis;  state Exp;
  21. branches ;
  22. next     1.4;
  23.  
  24. 1.4
  25. date     89.03.17.12.42.02;  author douglis;  state Exp;
  26. branches ;
  27. next     1.3;
  28.  
  29. 1.3
  30. date     88.11.19.15.53.06;  author douglis;  state Exp;
  31. branches ;
  32. next     1.2;
  33.  
  34. 1.2
  35. date     88.11.14.13.28.22;  author douglis;  state Exp;
  36. branches ;
  37. next     1.1;
  38.  
  39. 1.1
  40. date     88.09.04.22.37.23;  author douglis;  state Exp;
  41. branches ;
  42. next     ;
  43.  
  44.  
  45. desc
  46. @declarations internal to the loadavg program.
  47. @
  48.  
  49.  
  50. 1.7
  51. log
  52. @single '.')
  53. >> use the kernel idle time by default, but changes to support statting 
  54. if only it would work without requiring exclusive access
  55. @
  56. text
  57. @/*
  58.  * loadAvg.h --
  59.  *
  60.  *    Declarations internal to the loadavg program.
  61.  *
  62.  * Copyright 1987 Regents of the University of California
  63.  * All rights reserved.
  64.  *
  65.  *
  66.  * $Header: /a/newcmds/loadavg/RCS/loadavg.h,v 1.6 89/07/13 23:24:40 douglis Exp Locker: douglis $ SPRITE (Berkeley)
  67.  */
  68.  
  69. #ifndef _LOADAVG
  70. #define _LOADAVG
  71.  
  72. #include <time.h>
  73. #include <db.h>
  74. #include <mig.h>
  75. #include <stdio.h>
  76. #include <stdlib.h>
  77.  
  78. #include <proc.h>
  79. #include <kernel/net.h>
  80.  
  81. /*
  82.  * Subscripts into the queueThreshold array.
  83.  */
  84. #define MIN_THRESHOLD 0
  85. #define MAX_THRESHOLD 1
  86.  
  87. /*
  88.  * Arbitrary value larger than the load average on any node (we hope!)
  89.  */
  90. #define MAX_LOAD 1000.0
  91.  
  92. /*
  93.  * Buffer lengths.
  94.  */
  95. #define HOST_NAME_SIZE 64
  96. #define MAX_PATH_NAME_LENGTH 1024
  97.  
  98.  
  99. /*
  100.  * For each machine, keep track of the timestamp for its information and the
  101.  * different load averages reported.   Also, the architecture type
  102.  * (e.g., sun2/sun3/spur) is stored to make sure we can migrate to a machine
  103.  * of the same type.
  104.  */
  105.  
  106. /*
  107.  * If we are not allowing foreign processes, but our time since last input
  108.  * is greater than noInput and our average queue lengths are ALL less than
  109.  * the corresponding values in min, start accepting foreign processes.
  110.  *
  111.  * If we are allowing foreign processes and either the idle time drops
  112.  * or ANY of the average queue lengths exceeds its corresponding value in max,
  113.  * stop accepting them.
  114.  */
  115.  
  116. typedef struct {
  117.     int        noInput;
  118.     double    min[MIG_NUM_LOAD_VALUES];
  119.     double    max[MIG_NUM_LOAD_VALUES];
  120. } Thresholds;
  121.  
  122. typedef enum {
  123.     EVICT,
  124.     CHECK_COUNT
  125. } FindForeignParam;
  126.  
  127. /*
  128.  * Global variables.  (Options, plus other global vars initialized at startup.)
  129.  */
  130.  
  131. extern int debug;
  132. extern int verbose;
  133. extern int loadInterval;
  134. extern int writeInterval;
  135. extern int timeOut;
  136. extern int neverAccept;
  137. extern int alwaysAccept;
  138. extern int migVersion;
  139. extern int numLowPris;
  140. extern int useKernelIdleTime;
  141. extern char *dataFile;
  142. extern char *weightString;
  143. extern double weights[];
  144. extern Thresholds thresholds;
  145.  
  146. extern int errno;
  147.  
  148. extern int hostID;
  149. extern char *myName;
  150. extern char hostname[];
  151. extern char *machType;
  152. extern int kernelState;
  153. #ifdef INTERIM
  154. extern int oldKernel;
  155. #endif /* INTERIM */
  156.  
  157. /*
  158.  * Procedures.
  159.  */
  160.  
  161. extern void RunDaemon();
  162. extern int FindForeign();
  163.  
  164. extern char *malloc();
  165. extern char *strcpy();
  166. extern char *strerror();
  167. #endif _LOADAVG
  168.  
  169. @
  170.  
  171.  
  172. 1.6
  173. log
  174. @Don't charge low priority processes against the load average when deciding whether to accept migrations
  175. @
  176. text
  177. @d10 1
  178. a10 1
  179.  * $Header: /a/newcmds/loadavg/RCS/loadavg.h,v 1.5 89/05/04 15:49:00 douglis Exp Locker: douglis $ SPRITE (Berkeley)
  180. d84 1
  181. @
  182.  
  183.  
  184. 1.5
  185. log
  186. @changed to use the kernel state variable for import/export permissions.
  187. @
  188. text
  189. @d1 1
  190. a1 1
  191.     /*
  192. d10 1
  193. a10 1
  194.  * $Header: /a/newcmds/loadavg/RCS/loadavg.h,v 1.4 89/03/17 12:42:02 douglis Exp Locker: douglis $ SPRITE (Berkeley)
  195. d83 1
  196. @
  197.  
  198.  
  199. 1.4
  200. log
  201. @added decl. for strerror.
  202. @
  203. text
  204. @d10 1
  205. a10 1
  206.  * $Header: /a/newcmds/loadavg/RCS/loadavg.h,v 1.3 88/11/19 15:53:06 douglis Exp Locker: douglis $ SPRITE (Berkeley)
  207. a79 1
  208. extern int forkChild;
  209. d94 4
  210. @
  211.  
  212.  
  213. 1.3
  214. log
  215. @got rid of some obsolete declarations and converted some more over
  216. to use constants from mig.h.
  217. @
  218. text
  219. @d10 1
  220. a10 1
  221.  * $Header: /a/newcmds/loadavg/RCS/loadavg.h,v 1.2 88/11/14 13:28:22 douglis Exp Locker: douglis $ SPRITE (Berkeley)
  222. d105 1
  223. @
  224.  
  225.  
  226. 1.2
  227. log
  228. @converted to new library, mostly.
  229. @
  230. text
  231. @d1 1
  232. a1 1
  233. /*
  234. d10 1
  235. a10 1
  236.  * $Header: loadavg.h,v 1.1 88/09/04 22:37:23 douglis Exp $ SPRITE (Berkeley)
  237. d23 1
  238. a25 22
  239.  * Define pseudo-RPC protocol for named pipes.
  240.  *
  241.  *    LA_RPC_UPDATE        - update load statistics for a node
  242.  *    LA_RPC_IDLE        - get an idle node
  243.  *    LA_RPC_ALLINFO        - output statistics for all nodes
  244.  */
  245.  
  246. #define LA_RPC_UPDATE 0
  247. #define LA_RPC_IDLE 1
  248. #define LA_RPC_ALL_INFO 2
  249.  
  250. #define LOAD_NUM_VALUES 3
  251.  
  252. /*
  253.  * Define constants related to Sprite system characteristics and defaults.
  254.  */
  255.  
  256. #define STANDARD_OUTPUT 1
  257. #define OPEN_MODE 0664
  258. #define MAX_NUM_HOSTS 256
  259.  
  260. /*
  261. d32 1
  262. a32 1
  263.  * Arbitrary value larger than the load average on any node
  264. d62 2
  265. a63 2
  266.     double    min[LOAD_NUM_VALUES];
  267.     double    max[LOAD_NUM_VALUES];
  268. d66 5
  269. d81 3
  270. a83 1
  271. extern int lockFile;
  272. d101 1
  273. a101 2
  274. extern void RunServer();
  275. extern ReturnStatus OpenCreate();
  276. @
  277.  
  278.  
  279. 1.1
  280. log
  281. @Initial revision
  282. @
  283. text
  284. @d4 1
  285. a4 1
  286.  *    Declarations internal to the loadAvg program.
  287. d10 1
  288. a10 1
  289.  * $Header: loadAvg.h,v 2.7 88/05/15 21:01:24 douglis Exp $ SPRITE (Berkeley)
  290. d16 5
  291. a20 10
  292. #include "sprite.h"
  293. #include "status.h"
  294. #include "io.h"
  295. #include "mem.h"
  296. #include "fs.h"
  297. #include "proc.h"
  298. #include "time.h"
  299. #include "byte.h"
  300. #include "dataBase.h"
  301. #include "hostInfo.h"
  302. d22 2
  303. a46 11
  304.  * A record contains "%2d %3d %10d %10d %3.0f %3.0f %3.0f %5.2f %5.2f %5.2f\n",
  305.  * plus a null byte.  (This amounts to 54 bytes.)  Make it the next
  306.  * power of 2.
  307.  *
  308.  * Note that after this is debugged, this can be changed to write in binary
  309.  * form rather than converting to ASCII.
  310.  */
  311.  
  312. #define UTIL_RECORD_SIZE 64
  313.  
  314. /*
  315. d57 6
  316. a70 11
  317. typedef struct {
  318.     int        hostID;
  319.     int        archType;
  320.     int        utils[LOAD_NUM_VALUES];
  321.     double    lengths[LOAD_NUM_VALUES];
  322.     int     bootTime;
  323.     int     timestamp;
  324.     int     noInput;
  325.     Boolean    allowMigration;
  326. } NodeInfo;
  327.  
  328. d91 2
  329. a92 2
  330. extern Boolean debug;
  331. extern Boolean verbose;
  332. d96 2
  333. a97 2
  334. extern Boolean forkChild;
  335. extern Boolean lockFile;
  336. d103 2
  337. a105 1
  338. extern int archType;
  339. d107 2
  340. d118 2
  341. @
  342.